/**
 * 资源分配记录 类
 * resourceId           : 资源编号
 * processId            : 进程 id
 * allocationInstances  : 分配的实例数
 */
public class ResourceAllocation {

    private int resourceId;
    private int processId;
    private int allocatedInstances;

    public ResourceAllocation(int resourceId, int processId, int allocatedInstances) {
        this.resourceId = resourceId;
        this.processId = processId;
        this.allocatedInstances = allocatedInstances;
    }


    public int getResourceId() {
        return resourceId;
    }

    public int getProcessId() {
        return processId;
    }

    public int getAllocationInstances() {
        return allocatedInstances;
    }

    public void setResourceId(int resourceId) {
        this.resourceId = resourceId;
    }

    public void setProcessId(int processId) {
        this.processId = processId;
    }

    public void setAllocationInstances(int allocationInstances) {
        this.allocatedInstances = allocationInstances;
    }

    @Override
    public String toString() {
        return String.format("P%d → R%d×%d",
                processId, resourceId, allocatedInstances);
    }
}
